package com.iwhalecloud.bss.kite.cucc.service.route;

import java.util.Objects;

import com.iwhalecloud.bss.kite.cucc.service.route.enums.InfServRouteEnum;
import com.iwhalecloud.bss.kite.cucc.service.route.impl.AbstractInfServRoute;
import com.ztesoft.bss.common.util.SpringUtil;

/**
 * <Description> <br>
 * 接口服务调用路由工厂类
 * 
 * @author XXX<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2020年12月3日 <br>
 * @since R9.0<br>
 * @see com.iwhalecloud.bss.kite.cucc.service.route <br>
 */
public final class InfServRouteFactory {

    public static IInfServRoute getInstance() {
        return getInstance(InfServRouteEnum.DEFAULT_ROUTE);
    }

    public static IInfServRoute getInstance(InfServRouteEnum infServRouteEmun) {
        if (Objects.isNull(infServRouteEmun)) {
            infServRouteEmun = InfServRouteEnum.DEFAULT_ROUTE;
        }
        Class<? extends AbstractInfServRoute> clazz = infServRouteEmun.getClazz();
        return (IInfServRoute) SpringUtil.getBean(clazz);
    }
}
